<?php
/**
 * Created by PhpStorm.
 * User: lenovo
 * Date: 2020/5/19
 * Time: 14:42
 */

/**
 * aes加密
 * @param $str
 * @return string
 */
function aesEncrypt($str)
{
    return base64_encode(openssl_encrypt($str,'AES-128-CBC',getenv("AES_KEY"), 1,getenv("AES_IV")));
}


/**
 * aes解密
 * @param $str
 * @return string
 */
function aesDecrypt($str)
{
    return openssl_decrypt(base64_decode($str), 'AES-128-CBC', getenv("AES_KEY"), 1, getenv("AES_IV"));
}